home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
vol15n11.zip
/
CORYTD.TXT
next >
Wrap
Text File
|
1996-03-04
|
1KB
|
38 lines
Sub CorrectYTDCalc()
Dim FirstName As String, ReplaceName As String
Dim N As Integer
FirstName=Worksheets(1).Name
FirstName=FirstName & "!"
For N = 3 to Worksheets.Count
Worksheets(N).Activate
ReplaceName=Worksheets(N-1).Name
ReplaceName=ReplaceName & "!"
Range("A1", Range("A1").SpecialCells(xlLastCell)).Select
Selection.Replace what:=FirstName, replacement:=ReplaceName
Next N
End Sub
Function YTD(CellRef) As Double
Dim rw As Integer, cl As Integer, idx As Integer
rw = CellRef.Row
cl = CellRef.Column
For idx = 1 To ActiveSheet.Index
YTD = YTD + Worksheets(idx).Cells(rw, cl).Value
Next
End Function
Sub BuildFormula()
Dim CellRef As Range
Dim Address As String
Set CellRef = Application.InputBox(prompt:= _
"Click on a cell or type the reference", _
Title:="Which cell do you want in the sum?", _
Type:=8)
Address = CellRef.Address
ActiveCell.Formula = _
"=SUM(Jan:" & ActiveSheet.Name & "!" & Address & ")"
End Sub